package com.pojo;

import java.util.List;

public class Page<T> {
    public Integer pageNo;
    public Integer pageSize;
    public Integer start;
    public Integer end;
    public Integer count;
    public Integer maxPage;

    public List<T> list;

    public void setList(List<T> list) {
        if (this.pageNo == null) this.pageNo = 1;
        if (this.pageSize == null) this.pageSize = 10;

        this.start = (pageNo - 1) * pageSize + 1;
        this.end = pageNo * pageSize;
        this.count = list.size();
        this.list = list.subList(start - 1, end);
        this.maxPage = count / pageSize;
    }

	public Integer getPageNo() {
		return pageNo;
	}

	public void setPageNo(Integer pageNo) {
		this.pageNo = pageNo;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getStart() {
		return start;
	}

	public void setStart(Integer start) {
		this.start = start;
	}

	public Integer getEnd() {
		return end;
	}

	public void setEnd(Integer end) {
		this.end = end;
	}

	public Integer getCount() {
		return count;
	}

	public void setCount(Integer count) {
		this.count = count;
	}

	public Integer getMaxPage() {
		return maxPage;
	}

	public void setMaxPage(Integer maxPage) {
		this.maxPage = maxPage;
	}

	public List<T> getList() {
		return list;
	}

    
}
